com.cete.dynamicpdf
Class Section



Example : This example shows how to break the document into different sections.
   import com.cete.dynamicpdf.*;
   import com.cete.dynamicpdf.pageelements.*;
 
   public class MyClass {
     public static void main(String args[]) {
        // Create a PDF Document
        Document document = new Document();
        
        //Create a template object and add a page numbering label
        Template template = new Template();
        template.getElements().add( new PageNumberingLabel( "%%SP%% of %%ST%%", 0, 680, 512, 12, Font.getHelvetica(), 12, TextAlign.CENTER ) );
        
        document.setTemplate( template );
        
        //Begin the first section
        document.getSections().begin( NumberingStyle.ROMAN_LOWERCASE );
       //Add two pages
        document.getPages().add( new Page() ); //Page 1
        document.getPages().add( new Page() ); //Page 2
        
        //Begin the second section
        document.getSections().begin( NumberingStyle.NUMERIC, template );
        //Add three pages
        document.getPages().add( new Page() ); //Page 3
        document.getPages().add( new Page() ); //page 4
        document.getPages().add( new Page() ); //page 5
        
        //Begin the third section specifying a section prefix
        document.getSections().begin( NumberingStyle.ROMAN_LOWERCASE, "Appendix A - " );
        //Add two pages
        document.getPages().add( new Page() ); //page 6
        document.getPages().add( new Page() ); //page 7
        
        // Save the PDF document
        document.draw( "[physicalpath]/MyDocument.pdf" );
      }
    }